/*
 *      Author: Guannan Ma
 *      @mythmgn
 *      Whatever license applied
 */
#include "base.h"

/*
 * Thread-safe error system
 * */
#ifndef BASE_LIB_LIBERR_H
#define BASE_LIB_LIBERR_H

#ifdef	__cplusplus
extern "C"
{
#endif

extern unsigned int errGlobal;

enum ERR_LISTS{
  GLOBAL_NO_ERR=0,
  MEMORY_MALLOC_FAILURE,      /**< Memory allocation failed including malloc and realloc */
  FILE_NOT_EXIST,        /**< File does not exist */
  FILE_OPEN_FAILURE,       /**< Opening file failed */
  ITEM_ALREADY_EXIST,       /**< Item already exist */
  ITEM_NOT_FOUND,        /**< Item not found */
  REACH_MAX_SLOTS,        /**< Reach the maximum slots limit */
  INPUT_FORMAT_ERROR,      /**< Input format is not valid */
  INIT_FAILURE,
  INIT_NOT_INITED,
  ERROR_END
};
const char* const getErrMsg();
BOOL setErrStatusCode(uint32 errCode);
const uint32 getErrStatusCode();

#ifdef	__cplusplus
}
#endif

#endif // LIB_ERR_H_INCLUDED
